package com.example.rpcconsumer;

import com.example.rpcapi.service.UserRPCSersvice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
import org.springframework.stereotype.Component;

@SpringBootApplication
@ImportResource("classpath:dubbo.xml")
public class RpcConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(RpcConsumerApplication.class, args);
    }

    @Component
    public class UserRpcServiceTest implements CommandLineRunner {
        @Autowired
        private UserRPCSersvice userRPCSersvice;

        @Override
        public void run(String... args) throws Exception {
            System.out.println(userRPCSersvice.getUserById(1L));
        }
    }

}
